# Maintainer: christian rebischke <chris.rebischke@archlinux.org>

pkgname=gopass-summon-provider
pkgver=1.12.0
pkgrel=2
pkgdesc="summon provider for gopass"
arch=('loong64' 'x86_64')
url="https://github.com/gopasspw/gopass-summon-provider"
license=('MIT')
depends=('glibc')
makedepends=('go')
options=('!lto')
source=("${pkgname}-${pkgver}.tar.gz::https://github.com/gopasspw/gopass-summon-provider/archive/refs/tags/v${pkgver}.tar.gz")
sha512sums=('2ffb41d53cc370feb2c5c75c5a13680035f44b4432e092f84b977cfc62cbcb60e94eb2d3b2da931f647fed30bff3086397f044de34eb3010efb307662a48f23a')

prepare(){
  cd ${pkgname}-${pkgver}
  sed -i 's|-gcflags="-trimpath=$(GOPATH)" -asmflags="-trimpath=$(GOPATH)"||' Makefile
  sed -i 's/install-completion//g' Makefile
}

build(){
  cd ${pkgname}-${pkgver}
  export CGO_CPPFLAGS="${CPPFLAGS}"
  export CGO_CFLAGS="${CFLAGS}"
  export CGO_CXXFLAGS="${CXXFLAGS}"
  export CGO_LDFLAGS="${LDFLAGS}"
  export GOFLAGS="-buildmode=pie -trimpath -mod=readonly -modcacherw"
  make
}

package() {
  cd ${pkgname}-${pkgver}
  make DESTDIR="${pkgdir}" PREFIX="/usr" install
  install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
